package com.itheima.mapper;

import com.itheima.pojo.Achievement;
import org.apache.ibatis.annotations.*;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * @author huangbin
 * @date 2022/6/6 19:19
 */
@Mapper
public interface AchievementMapper {
    @Insert("insert into achievement values(null,#{time},#{price},#{accountType},#{scoreId},#{staffId});")
    @ResultMap("ResultAchievementMapper")
    Integer add(Achievement achievement);
    @Select("SELECT sum(achievement.price) as sumMprice FROM achievement WHERE date_format(time , '%Y %m') = date_format(DATE_SUB(curdate(), INTERVAL 0 MONTH),'%Y %m');")
    BigDecimal sumMPrice();

    List<Map<String,Object>> IdMPrice();
}
